<template>
  <el-card class="type-bar">
    <el-button v-for="(item, idx) in typeList"
               :key="idx"
               type="primary"
               plain
               @click="add(item)">{{ item.label }}</el-button>
  </el-card>
</template>

<script>
import { formTypesConfObj } from '../function/data'
import _ from 'loadsh'
export default {
  data() {
    return {
      typeList: Object.values(formTypesConfObj())
    }
  },
  methods: {
    add(item) {
      this.$EventBus.$emit('addFormItem', { item: _.cloneDeep(item) })
    }
  }
}
</script>

<style lang="scss">
.type-bar {
  .el-button--primary.is-plain {
    margin: 5px;
  }
}
</style>
